import axios from 'axios'

// 创建axios实例
const service = axios.create({
  // baseURL: 可选，建议用你已有的 baseURL
  timeout: 10000
})

// 请求拦截器
service.interceptors.request.use(
  config => {
    const token = localStorage.getItem('token')
    if (token) {
      config.headers['token'] = token
    }
    return config
  },
  error => Promise.reject(error)
)

export default service
